import { request } from '@umijs/max';
const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION } = process.env;
let access = ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site' ? 'admin' : '';

const getAccess = () => {
  return access;
};

/** 登录接口 POST /login/account */
export async function login (body: API.LoginParams, options?: Record<string, any>) {
  return request<API.LoginResult>('/API/login', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

//获取个人信息
export async function getInfo (body: API.LoginParams, options?: Record<string, any>) {
  console.log('getAccess',getAccess())
  return request<API.LoginResult>('/api/currentUser', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
